﻿using System;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using OmegaEngine;

namespace OmegaEngine
{
    public class GUILabel : GUIActor
    {
        string text = "";
        SpriteFont font = Engine.DefaultFont;
        Color color = Color.White;

        // Tons of constructors
        public GUILabel(string Text)
            : base(Engine.DefaultFont.MeasureString(Text))
        {
            SetupLabel(Text, Engine.DefaultFont, Color.White);
        }

        public GUILabel(string Text, GameScreen Parent)
            : base(Engine.DefaultFont.MeasureString(Text), Parent)
        {
            SetupLabel(Text, Engine.DefaultFont, Color.White);
        }

        public GUILabel(string Text, SpriteFont Font)
            : base(Font.MeasureString(Text))
        {
            SetupLabel(Text, Font, Color.White);
        }

        public GUILabel(string Text, SpriteFont Font, GameScreen Parent)
            : base(Font.MeasureString(Text), Parent)
        {
            SetupLabel(Text, Font, Color.White);
        }

        public GUILabel(string Text, SpriteFont Font, int PositionX, int PositionY)
            : base(Font.MeasureString(Text), PositionX, PositionY)
        {
            SetupLabel(Text, Font, Color.White);
        }

        public GUILabel(string Text, SpriteFont Font, int PositionX, int PositionY, GameScreen Parent)
            : base(Font.MeasureString(Text), PositionX, PositionY, Parent)
        {
            SetupLabel(Text, Font, Color.White);
        }

        public GUILabel(string Text, SpriteFont Font, int PositionX, int PositionY, Color Color)
            : base(Font.MeasureString(Text), PositionX, PositionY)
        {
            SetupLabel(Text, Font, Color);
        }

        public GUILabel(string Text, SpriteFont Font, int PositionX, int PositionY, Color Color, GameScreen Parent)
            : base(Font.MeasureString(Text), PositionX, PositionY, Parent)
        {
            SetupLabel(Text, Font, Color);
        }

        void SetupLabel(string Text, SpriteFont Font, Color Color)
        {
            this.text = Text;
            this.font = Font;
            this.color = Color;
        }

        public void UpdateText(string Text)
        {
            this.text = Text;
        }

        public override void Draw()
        {
            Engine.SpriteBatch.DrawString(this.font, this.text, new Vector2(this.positionX, this.positionY), this.color);

            base.Draw();
        }
    }
}
